package com.example.demo;

import org.springframework.beans.factory.annotation.Value;
import org.springframework.stereotype.Controller;
import org.springframework.validation.annotation.Validated;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.ResponseBody;

/**
 * Created with IntelliJ IDEA.
 * Description:
 * User: H_tao_X
 * Date: 2022-07-12
 * Time: 11:25
 */
@Controller
public class Test {

   @Value("${server.port}") // 读取配置项
   private String port; // 用来接收读取的配置项

    @ResponseBody  //返回一个非静态页面的数据
    @RequestMapping("/fun")  //设置路由地址
    public String  func() {
        return "hello world，| port " + port;
    }
}
